﻿//using CnManageCpp;
//using testclr;
using LoadingWK;

using System;
using DevExpress.XtraBars;
using System.Threading;
using System.Globalization;
using System.Windows.Forms;
using System.Collections.Generic;

namespace DisplayTableData
{
    public partial class MianWindow : DevExpress.XtraBars.TabForm
    {
        public MianWindow()
        {
            InitializeComponent();
        }
        static int OpenFormCount = 1;

        private AirplanLoading _airplanLoading = new AirplanLoading();

        private Equipment createEquipment(
            Int32 id,
            double Length,
            double Width,
            double Height,
            double Weight,
            double Focus_PositionY
            )
        {
            Equipment equip1 = new Equipment();
            equip1._id = id;
            equip1._length = Length;
            equip1._width = Width;
            equip1._height = Height;
            equip1._weight = Weight;
            equip1._gravityY = Focus_PositionY;
            equip1.addAxleLoad(new AxleLoad(Focus_PositionY, Weight));

            return equip1;
        }
        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            List<Equipment> equipmentList = new List<Equipment>();
            Int32 equipID = 1;
            equipmentList.Add(createEquipment(equipID++, 8417, 3334, 2679, 7860, 4000));//"斯太尔"
            //equipmentList.Add(createEquipment(equipID++, 8417, 3334, 2679, 7860, 4000));//"斯太尔"
            //equipmentList.Add(createEquipment(equipID++, 3200, 1830, 1830, 17000, 1500));//"供气拖车"
            //equipmentList.Add(createEquipment(equipID++, 6276, 2148, 2299, 5000, 3000));//"电源车"
            //equipmentList.Add(createEquipment(equipID++, 6276, 2148, 2299, 5000, 3000));//"电源车"
            //equipmentList.Add(createEquipment(equipID++, 3200, 1830, 1830, 17000, 1500));//"供气拖车"

            _airplanLoading.importInformationOfEquipments(equipmentList);
        }

        private void barButtonItem2_ItemClick_1(object sender, ItemClickEventArgs e)
        {
            double minSpacing = 100.0;
            Airplane airplane = new Airplane();
            //运-20
            airplane._length = 18500/*loadedLength*/;airplane._width = 3900/*LoadWidth*/; airplane._height = 38000/*LoadHeight*/;
            airplane._maxLoadWeight = 50000/*MaxLoadWeight*/;
            airplane._gravityY = 12684/*CenterPoint*/;
            airplane._minY = 11683.5/*MinCenterY*/;
            airplane._maxY = 12890.4/*MaxCenterY*/;
            airplane._weight = 50000/*Weight*/;
            airplane._locationTypeOfStartLoading = 0/*前端开始装载*/;

            airplane._weightLimitOfAreaList.Add(new WeightLimit(0,3859.789,10000));
            airplane._weightLimitOfAreaList.Add(new WeightLimit(3859.789,6610.689,13000));
            airplane._weightLimitOfAreaList.Add(new WeightLimit(6610.689,14897.479,55000));
            airplane._weightLimitOfAreaList.Add(new WeightLimit(14897.479,18004.509,13000));

            _airplanLoading.importInformationOfAirplane(airplane, minSpacing);

        }

        private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
        {
            LoadedEquipmentList list = _airplanLoading.startLoading(10);
            
        }
    }
}
